﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Wise.Util;

namespace NHI.Sync.Tools.Forms
{
    public class RadioButtonConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (parameter is string)
                return Object.Equals(value, Boolean.Parse((string)parameter));
            return Object.Equals(value, parameter);

        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (parameter is string)
                return !Object.Equals(value, Boolean.Parse((string)parameter));
            return !Object.Equals(value, parameter);
        }
    }
}
